package com.example.foo.account;

import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAccessor;

public class AccountHelper {

	private static final DateTimeFormatter FORMATTER_yyyyMM = DateTimeFormatter.ofPattern("yyyyMM");
	public static Integer toPeriodMonth(TemporalAccessor temporal) {
		return Integer.parseInt(FORMATTER_yyyyMM.format(temporal));
	}

	private static final DateTimeFormatter FORMATTER_yyyyMMdd = DateTimeFormatter.ofPattern("yyyyMMdd");
	public static Integer toPeriodDay(TemporalAccessor temporal) {
		return Integer.parseInt(FORMATTER_yyyyMMdd.format(temporal));
	}

}
